{extend name="base" /}
{block name="content"}
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>系统</span>
            <span class="icon-angle-right"></span>
            <span>用户管理</span>
            <span class="icon-angle-right"></span>
            <span>用户列表</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <table class="m-table">
                <tr>
                    <th>
                        <div class="m-options cf">
                            <div class="m-opts fl"><a href="{:url('add')}" class="u-btn"><i class="icon-plus"></i>添加用户</a></div>
                            <div class="m-search fr">
                                <form action="" class="layui-form">
                                    <div class="lay-select">
                                        <select name="role_id">
                                            <option value="0">请选择用户角色</option>
                                            {foreach name="roles" item="role"}
                                            <option value="{$role.id}"{if condition="input('get.role_id') eq $role['id']"} selected{/if}>{$role.name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                    <input type="submit" class="u-btn u-search" value="查看" />
                                </form>
                            </div>
                        </div>
                    </th>
                </tr>
            </table>
            <form class="layui-form">
                <table class="m-table mt-10">
                    <tbody class="datas">
                        <tr>
                            <th width="5%">ID</th>
                            <th width="15%">用户名</th>
                            <th width="15%">用户角色</th>
                            <th width="10%">登录次数</th>
                            <th width="10%">最后一次登录 ip</th>
                            <th width="15%">最后一次登录时间</th>
                            <th width="10%">创建时间</th>
                            <th width="10%">状态</th>
                            <th width="10%">操作</th>
                        </tr>
                        {foreach name="data" item="v"}

                                <tr>
                                    <td>{$v.id}</td>
                                    <td>{$v.username}</td>
                                    <td>{$v.role_name}</td>
                                    <td>{$v.login_nums}</td>
                                    <td>{$v.last_login_ip}</td>
                                    <td>{$v.last_login_time}</td>
                                    <td>{$v.create_time}</td>
                                    <td><input type="checkbox" name="status" data-id="{$v.id}" lay-skin="switch" lay-filter="switch" lay-text="开启|禁用"{$v.status ? ' checked' : ''} /></td>
                                    <td class="m-opt"><a href="{:url('add', ['id' => $v.id])}" title="编辑"><i class="icon-pencil"></i></a><a href="javascript:;" title="删除" class="u-del" data-id="{$v.id}"><i class="icon-trash"></i></a></td>
                                </tr>

                        {/foreach}
                    </tbody>
                </table>
            </form>
            {include file="public:page" /}
        </div>
    </div>
</div>
{/block}
{block name="extrajs"}
{include file="laypage" /}
{/block}